package main.FileVisitors.FileVisitorImpl;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.FileVisitor;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.List;

public class DriveRootDirectories implements FileVisitor<Path> {

    private List<Path> rootDirectories = new ArrayList<Path>();

    @Override
    public FileVisitResult postVisitDirectory(Path arg0, IOException arg1) throws IOException {
        return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult preVisitDirectory(Path arg0, BasicFileAttributes arg1) throws IOException {
        rootDirectories.add(arg0);
        return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult visitFile(Path arg0, BasicFileAttributes arg1) throws IOException {
        return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult visitFileFailed(Path arg0, IOException arg1) throws IOException {
        return FileVisitResult.CONTINUE;
    }

    /**
     * @return the rootDirectories
     */
    public List<Path> getRootDirectories() {
        return rootDirectories;
    }

    /**
     * @param rootDirectories the rootDirectories to set
     */
    public void setRootDirectories(List<Path> rootDirectories) {
        this.rootDirectories = rootDirectories;
    }
}
